package com.pers.springcloud.service.impl;

import com.pers.springcloud.entities.Payment;
import com.pers.springcloud.mapper.PaymentMapper;
import com.pers.springcloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: 黄建
 * @Date: 2020/3/6 18:19
 */
@Service
public class PaymentServiceImpl implements PaymentService {

    @Autowired
    private PaymentMapper paymentMapper;

    @Override
    public Long create(Payment payment){
        paymentMapper.insertUseGeneratedKeys(payment);
        return payment.getId();
    }

    @Override
    public Payment getPaymentById(Long id){
        Payment payment=new Payment();
        payment.setId(id);
        return paymentMapper.selectOne(payment);
    }
}
